import React, { Component } from 'react';
// import {clearShopcart,shopcartlist} from '../../utils/api'
// import {Toast} from 'antd-mobile'
class MyHeader extends Component {
    //清空购物车
    // handleClear(){
    //     Toast.show({icon:'success',content:'已清空购物车'})
    //     clearShopcart({userid:localStorage.getItem('userid')}).then((res)=>{
    //         shopcartlist({userid:localStorage.getItem('userid')}).then((res)=>{
    //             this.setState({
    //              list:res.data.list
    //             })
    //          })
    //         // window.location.reload()
    //     })
    // }


    state = {
        userinfo: JSON.parse(localStorage.getItem('userinfo')),
    }
    render() {
        return (
            <div className='shopcartheader'>
                <div className='title'>
                    购物车
                </div>
                <div className='header'>
                    <div className="left">
                        <img src={this.state.userinfo.avatarUrl} alt="头像" />
                        <span>{this.state.userinfo.phone}</span>
                    </div>
                    {/* onClick={()=>{this.handleClear()}} */}
                    <div>管理</div>
                </div>
                <div className='choose'>
                    <div className='black'><span>抢购</span>&nbsp;&nbsp;已满￥200,享超值换购,已选0/1</div>
                    <div className='orange'>立即挑选&nbsp;&gt;</div>
                </div>
            </div>
        );
    }
}

export default MyHeader;